import request from '/@/utils/request';

// 登录
export const login = (data: any) => {
	return request({
		url: '/adminapi/admin/login',
		method: 'post',
		data,
	});
};

// 获取验证码
export const verificationCode = (data: any) => {
	return request({
		url: '/admin/verificationCode',
		method: 'post',
		headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
		responseType: 'blob',
		data,
	});
};

// 获取角色列表
export const getRoleList = (data: any) => {
	return request({
		url: '/common/role/list',
		method: 'post',
		data,
	});
};

// 获取全部菜单
export const getEmnuList = (data: any) => {
	return request({
		url: '/common/menu/list',
		method: 'post',
		data,
	});
};

// 添加角色
export const addRole = (data: any) => {
	return request({
		url: '/common/role/addOrEdit',
		method: 'post',
		data,
	});
};

// 角色启用/禁用
export const roleEnble = (data: any) => {
	return request({
		url: '/common/role/status',
		method: 'post',
		data,
	});
};

// 获取用户列表
export const getUserList = (data: any) => {
	return request({
		url: '/common/user/list',
		method: 'post',
		data,
	});
};

// 用户启用/禁用
export const userEnble = (data: any) => {
	return request({
		url: '/common/user/status',
		method: 'post',
		data,
	});
};
// 添加 / 编辑 用户
export const addUser = (data: any) => {
	return request({
		url: '/common/user/addOrEdit',
		method: 'post',
		data,
	});
};
// 管理员关联角色
export const userRole = (data: any) => {
	return request({
		url: '/common/user/role',
		method: 'post',
		data,
	});
};

// 用户修改密码
export const editPwd = (data: any) => {
	return request({
		url: '/common/user/changePwd',
		method: 'post',
		data,
	});
};

//site装修模版
export const getSiteTemplate = (data: any) => {
	return request({
		url: '/site/template/list',
		method: 'post',
		data,
	});
};

//saas装修模版
export const getTemplate = (data: any) => {
	return request({
		url: '/saas/template/list',
		method: 'post',
		data,
	});
};

//site-装修模板添加/编辑
export const addOrEditSite = (data: any) => {
	return request({
		url: '/site/template/addOrEdit',
		method: 'post',
		data,
	});
};

//系统-装修模板添加/编辑
export const addOrEdit = (data: any) => {
	return request({
		url: '/saas/template/addOrEdit',
		method: 'post',
		data,
	});
};

//系统-装修模板启用/禁用
export const doTemplateStatus = (data: any) => {
	return request({
		url: '/saas/template/status',
		method: 'post',
		data,
	});
};

//site-装修模板启用/禁用
export const doSiteTemplateStatus = (data: any) => {
	return request({
		url: '/site/agreement/status',
		method: 'post',
		data,
	});
};
//获取分类
export const getCategory = (data: any) => {
	return request({
		url: '/site/category/list',
		method: 'post',
		data,
	});
};

//添加分类
export const addCategory = (data: any) => {
	return request({
		url: '/site/category/addOrEdit',
		method: 'post',
		data,
	});
};

//删除分类
export const delCategory = (data: any) => {
	return request({
		url: '/site/category/del',
		method: 'post',
		data,
	});
};

//获取服务标签
export const getLabel = (data: any) => {
	return request({
		url: '/mall/tag/list',
		method: 'post',
		data,
	});
};

//添加服务标签
export const addLabel = (data: any) => {
	return request({
		url: '/mall/tag/addOrEdit',
		method: 'post',
		data,
	});
};

//删除服务标签
export const delLabel = (data: any) => {
	return request({
		url: '/mall/tag/del',
		method: 'post',
		data,
	});
};

// 地区列表
export const cityList = (data: any) => {
	return request({
		url: '/admin/city/list',
		method: 'post',
		data,
	});
};

//协议列表
export const getAgreement = (data: any) => {
	return request({
		url: '/saas/agreement/list',
		method: 'post',
		data,
	});
};

//site协议列表
export const getSiteAgreement = (data: any) => {
	return request({
		url: '/site/agreement/list',
		method: 'post',
		data,
	});
};

// 运费模板列表
// mall/freight/list
export const freightList = (data: any) => {
	return request({
		url: 'mall/freight/list',
		method: 'post',
		data,
	});
};

//添加协议
export const addAgreement = (data: any) => {
	return request({
		url: '/saas/agreement/addOrEdit',
		method: 'post',
		data,
	});
};

//站点-添加协议
export const addSiteAgreement = (data: any) => {
	return request({
		url: '/site/agreement/addOrEdit',
		method: 'post',
		data,
	});
};

// 运费模板增加和编辑
// mall/freight/addOrEdit
export const freightAddOrEdit = (data: any) => {
	return request({
		url: 'mall/freight/addOrEdit',
		method: 'post',
		data,
	});
};

//协议详情
export const getAgreementInfo = (data: any) => {
	return request({
		url: '/saas/agreement/info',
		method: 'post',
		data,
	});
};

// 站点-协议详情
export const getSiteAgreementInfo = (data: any) => {
	return request({
		url: '/site/agreement/info',
		method: 'post',
		data,
	});
};

// 运费模板删除
// mall/freight/del
export const freightDel = (data: any) => {
	return request({
		url: '/mall/freight/del',
		method: 'post',
		data,
	});
};

export const doAgreementStatus = (data: any) => {
	return request({
		url: '/saas/agreement/status',
		method: 'post',
		data,
	});
};

// 商品列表
export const getGoodsList = (data: any) => {
	return request({
		url: '/site/goods/list',
		method: 'post',
		data,
	});
};

// 添加商品
export const addGoodsInfo = (data) => {
	return request({
		url: '/site/goods/addOrEdit',
		method: 'post',
		data,
	});
};

// 商品详情
export const getGoodsInfo = (data) => {
	return request({
		url: '/site/goods/info',
		method: 'post',
		data,
	});
};

// 商品的上架 / 下架
export const changeGoodsStatus = (data) => {
	return request({
		url: '/site/goods/status',
		method: 'post',
		data,
	});
};

// 商品首页推荐
// /site/goods/setIndex
export const goodsSetIndex = (data) => {
	return request({
		url: '/site/goods/setIndex',
		method: 'post',
		data,
	});
};
// /site/template/status
// 装修模板的启用
export const siteTemStatus = (data) => {
	return request({
		url: '/site/template/status',
		method: 'post',
		data,
	});
};

// 站点-生效中的系统协议模板
export const getagreementsaasInfo = (data) => {
	return request({
		url: '/site/agreement/saasList',
		method: 'post',
		data,
	});
};

// 站点-订单列表
export const getOrderList = (data) => {
	return request({
		url: '/site/order/list',
		method: 'post',
		data,
	});
};

// 站点-获取快递公司列表
export const getLogisticsList = (data) => {
	return request({
		url: '/admin/logistics/list',
		method: 'post',
		data,
	});
};

//订单发货;
export const doOrderSend = (data) => {
	return request({
		url: '/site/order/send',
		method: 'post',
		data,
	});
};

export const authAlipayUrl = (data) => {
	return request({
		url: 'site/auth/authAlipayUrl',
		method: 'post',
		data,
	});
};

export const authAlipayBack = (data) => {
	return request({
		url: 'site/auth/authAlipayBack',
		method: 'post',
		data,
	});
};

export const authAlipayToken = (data) => {
	return request({
		url: 'site/auth/authAlipayToken',
		method: 'post',
		data,
	});
};

// 添加供货商
export const addSupplier = (data) => {
	return request({
		url: 'saas/supplier/add',
		method: 'post',
		data,
	});
};

// 编辑供货商
export const editSupplier = (data) => {
	return request({
		url: 'saas/supplier/edit',
		method: 'post',
		data,
	});
};

// 供货商列表
export const getSupplier = (data) => {
	return request({
		url: 'saas/supplier/list',
		method: 'post',
		data,
	});
};

// 售后列表
export const getAfterSalesList = (data) => {
	return request({
		url: 'saas/aftersales/list',
		method: 'post',
		data,
	});
};

// 获取售后详情
export const getAfterSalesInfo = (data) => {
	return request({
		url: 'saas/aftersales/info',
		method: 'post',
		data,
	});
};

// 处理售后
export const doAfterSalesHandle = (data) => {
	return request({
		url: 'saas/aftersales/handle',
		method: 'post',
		data,
	});
};

// 确认收货并退款
export const doAftersalesConfirm = (data) => {
	return request({
		url: 'saas/aftersales/confirm',
		method: 'post',
		data,
	});
};

// 用户选择换货时厂家收到货后的重新发货
export const doAfterSalesReSend = (data) => {
	return request({
		url: 'saas/aftersales/reSend',
		method: 'post',
		data,
	});
};

// 订单导出
export const doExport = (data) => {
	return request({
		url: 'site/order/export',
		method: 'post',
		responseType: 'blob',
		data,
	});
};

// 订单导出
export const editWeight = (data) => {
	return request({
		url: 'site/goods/editWeight',
		method: 'post',
		responseType: 'blob',
		data,
	});
};

// 获取oss配置

export const getSsoUrl = (data?: object) => {
	return request({
		url: '/adminapi/common/uploadKey',
		method: 'post',
		data,
	});
}

// 查询商品信息
export const getProduct = (data?: object) => {
	return request({
		url: '/adminapi/product',
		method: 'get',
		data,
	});
}

// 修改商品信息
export const setProduct = (data?: object) => {
	return request({
		url: '/adminapi/product',
		method: 'post',
		data,
	});
}

// 查询分享记录
export const getShare = (data?: object) => {
	return request({
		url: '/adminapi/share',
		method: 'get',
		params: data,
	});
}

// 分享结算
export const setShareClear = (data?: object) => {
	return request({
		url: '/adminapi/share/clear',
		method: 'post',
		data,
	});
}

// 查询系统设置
export const getSystem = (data?: object) => {
	return request({
		url: '/adminapi/system',
		method: 'get',
		data,
	});
}

// 系统设置修改
export const setSystem = (data?: object) => {
	return request({
		url: '/adminapi/system',
		method: 'post',
		data,
	});
}

// 系统设置修改
export const getUserData = (data?: object) => {
	return request({
		url: '/adminapi/user',
		method: 'get',
		params: data,
	});
}

// 查询分享统计
export const getShareCount = (data?: object) => {
	return request({
		url: '/adminapi/share/count',
		method: 'get',
		params: data,
	});
}